From f7f39e3ac3944a3a56cfc57696347c485aea941c Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Tue, 11 Sep 2007 11:21:44 +0100 Subject: [PATCH] x86: Use halt() macro instead of direct HLT asm. Signed-off-by: Keir Fraser --- xen/arch/x86/crash.c | 2 +- xen/arch/x86/setup.c | 2 +- xen/arch/x86/shutdown.c | 7 ++++--- xen/arch/x86/smp.c | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c index 398fd781d2..831dc7e04d 100644 --- a/xen/arch/x86/crash.c +++ b/xen/arch/x86/crash.c @@ -46,7 +46,7 @@ static int crash_nmi_callback(struct cpu_user_regs *regs, int cpu) hvm_cpu_down(); for ( ; ; ) - __asm__ __volatile__ ( "hlt" ); + halt(); return 1; } diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 99b752ac38..94b66e2950 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -168,7 +168,7 @@ static void __init do_initcalls(void) #define EARLY_FAIL(f, a...) do { \ printk( f , ## a ); \ - for ( ; ; ) __asm__ __volatile__ ( "hlt" ); \ + for ( ; ; ) halt(); \ } while (0) static unsigned long __initdata initial_images_start, initial_images_end; diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c index 7653dce4fd..c66c3fa019 100644 --- a/xen/arch/x86/shutdown.c +++ b/xen/arch/x86/shutdown.c @@ -38,10 +38,11 @@ static inline void kb_wait(void) break; } -static void __attribute__((noreturn)) __machine_halt(void *unused) +static void __attribute__((noreturn)) __machine_halt(void *unused) { + local_irq_disable(); for ( ; ; ) - __asm__ __volatile__ ( "hlt" ); + halt(); } void machine_halt(void) @@ -213,7 +214,7 @@ void machine_restart(void) on_selected_cpus(cpumask_of_cpu(0), (void *)machine_restart, NULL, 1, 0); for ( ; ; ) - safe_halt(); + halt(); } smp_send_stop(); diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c index 550faf069b..660c26436f 100644 --- a/xen/arch/x86/smp.c +++ b/xen/arch/x86/smp.c @@ -319,13 +319,15 @@ int on_selected_cpus( static void stop_this_cpu (void *dummy) { + ASSERT(!local_irq_is_enabled()); + disable_local_APIC(); hvm_cpu_down(); cpu_clear(smp_processor_id(), cpu_online_map); for ( ; ; ) - __asm__ __volatile__ ( "hlt" ); + halt(); } /* -- 2.30.2